package com.yequan.thread.pc;

import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Main {

    public static void main(String[] args) {
//        Table table = new Table(3);
//        new Maker("蛋糕师111", table).start();
//        new Maker("蛋糕师222", table).start();
//        new Maker("蛋糕师333", table).start();
//        new Maker("蛋糕师444", table).start();
//        new Maker("蛋糕师555", table).start();
//
//        new Consumer("消费者111", table).start();
//        new Consumer("消费者222", table).start();
//        new Consumer("消费者333", table).start();
//        new Consumer("消费者444", table).start();
//        new Consumer("消费者555", table).start();

//        ThreadPoolExecutor executorService = ((ThreadPoolExecutor) Executors.newFixedThreadPool(10));
//        executorService.setKeepAliveTime(20L, TimeUnit.SECONDS);
//        executorService.allowCoreThreadTimeOut(true);
//        executorService.execute(() -> System.out.println("test"));

        Map<Integer, Set<Integer>> poolMap = new HashMap<>();
        Set<Integer> set1 = new HashSet<>();
        poolMap.put(1,set1);
        Set<Integer> pool = poolMap.get(1);
        if (null == pool) {
            pool = new HashSet<>();
            poolMap.put(1, pool);
        }
        Set<Integer> pool2 = poolMap.get(1);
        Set<Integer> remove = poolMap.remove(1);
        Set<Integer> integers = poolMap.get(1);
        System.out.println(pool == pool2);
    }

}
